home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Lib / or / or_or2std.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  1.8 KB  |  92 lines

  1. /* or_or2std.c: convert interanl list to standard format or name */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/or/RCS/or_or2std.c,v 6.0 1991/12/18 20:23:08 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Lib/or/RCS/or_or2std.c,v 6.0 1991/12/18 20:23:08 jpo Rel $
  9.  *
  10.  * $Log: or_or2std.c,v $
  11.  * Revision 6.0  1991/12/18  20:23:08  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include "or.h"
  19. #include "util.h"
  20.  
  21. void or_or2std (or, buf, nicepn)
  22. OR_ptr          or;
  23. char            *buf;
  24. int             nicepn;   /* pretty pn required ? */
  25. {
  26.     OR_ptr        ptr;
  27.     char        tbuf[LINESIZE];
  28.     int        gotpn,
  29.             addslash;
  30.  
  31.  
  32.     PP_DBG (("or_or2std ()"));
  33.  
  34.     buf[0] = '\0';
  35.  
  36.     if (nicepn) {
  37.         gotpn = or_getpn (or, buf);
  38.         if (!gotpn)
  39.             buf[0] = '\0';
  40.     }
  41.     else
  42.         gotpn = FALSE;
  43.  
  44.     ptr = or_lastpart (or);
  45.  
  46.     for (addslash = FALSE ; ptr != NULLOR; ptr = ptr -> or_prev ) {
  47.  
  48.         PP_DBG ((
  49.         "or_or2std: Comp type='%d' ddname='%s' value='%s'",
  50.              ptr -> or_type, 
  51.              ptr-> or_ddname ? ptr -> or_ddname : "<none>", 
  52.              ptr -> or_value ? ptr -> or_value : "<none>"
  53.         ));
  54.  
  55.         if (gotpn && (ptr -> or_type == OR_S ||
  56.                 ptr -> or_type == OR_G ||
  57.                 ptr -> or_type == OR_I))
  58.                     continue;
  59.  
  60.         addslash = TRUE;
  61.  
  62.         (void) strcat (buf, "/");
  63.  
  64.         if (ptr -> or_type == OR_DD) {
  65.                 if (or_ddvalid_chk (ptr -> or_ddname, &tbuf[0]) == NOTOK)
  66.             {
  67.                 (void) strcat (buf, "DD.");
  68.                 qstrcat (buf, ptr -> or_ddname );
  69.                 }
  70.                 else
  71.                 qstrcat (buf, tbuf);
  72.  
  73.                 (void) strcat (buf, "=");
  74.                 qstrcat (buf, ptr -> or_value);
  75.         }
  76.         else {
  77.             char    *name;
  78.             if ((name = or_type2name (ptr -> or_type)) != NULLCP)
  79.                 (void) strcat (buf, name);
  80.             else 
  81.                 (void) strcat (buf, "BOGUS");
  82.                 (void) strcat (buf, "=" );
  83.                 qstrcat (buf, ptr -> or_value);
  84.         }
  85.     }
  86.  
  87.     if (addslash)
  88.         (void) strcat (buf, "/");
  89.  
  90.     PP_DBG (("or_or2std returns ('%s')", buf));
  91. }
  92.